<%@page import="java.util.ArrayList"%>
<%@page import="java.util.Iterator"%>

<%@page import="dao.MorteDAO"%>
<%@page import="beans.Morte"%>

<%	MorteDAO morteDAO = new MorteDAO();

	String param[] = request.getParameter("rebanho").split("/");
	int mes = Integer.parseInt(param[0]);
	int ano = Integer.parseInt(param[1]);

	ArrayList<Morte> mortes = morteDAO.loadRebanho(mes, ano);
	Iterator it = mortes.iterator();
	
	String imgLink = "";
%>

<!DOCTYPE html>
<html>
    <%@include file = "header.html" %>
    <body>
        <%@include file="topo.jsp" %>
        <%@include file="menu.jsp" %>

        <div id="content">
            <h2>Mortes no rebanho de <%= mes%>/<%= ano%></h2>
            <table border="0" cellspacing="2">
                <thead>
                    <tr>
                        <th>Brinco</th>
                        <th>Data</th>
						<th>Motivo</th>
						<th>Editar</th>
                    </tr>
                </thead>
                <tbody>
                    <%	while (it.hasNext()) {
                            Morte morte = (Morte) it.next();
                    %>
                    <tr> 
                        <td><%= morte.getNum_brinco()%></td>
                        <td><%= morte.getData() %></td>
                        <td><%= morte.getMotivo() %></td>
                        <td><img src="<%= imgLink %>"/></td>
                    </tr>
                    <% }%>
                </tbody>
            </table>
        </div>

    </body>
</html>
